<template>
	<view>
		<!-- 导航 -->
		<view class="nav">
			<view class="tar">
				<view class="nav_item" @click="jianzhi">
					<view class="iconfont icon-jianzhi" ></view>
					<text>兼职</text>
				</view>
				<view class="nav_item" @click="quanzhi">
					<view class="iconfont icon-34"></view>
					<text>全职</text>
				</view>
			</view>
			
			<view class="" v-if="flag" v-for="item in jianzhi1" :key="item.id" @click="jzDetail(item.id)">

				<view class="body">
					<view class="work_list">
						
						<view class="work_item">
							<view>
								<image :src="item.img"></image>
							</view>
							<view>
								<view class="price">
									<view>{{item.name}}</view>
									
									<view>{{item.type}}</view>
								</view>
								<view class="name">
									<view class="iconfont icon-gongsi"></view>
									<view>{{item.company}}</view>
								</view>
								<view class="time1">
									<view class="iconfont icon-shijian"></view>
									<view>{{item.time1}} - {{item.time2}}</view>
									<view>{{item.money}}/元每天</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				
			</view>
			
			<view class="" v-if="flag1" v-for="item in quanzhi1" :key="item.id" @click="qzDetail(item.id)">
				<!-- <view >{{item.image}}</view> -->
				<view class="body">
					<view class="work_list">
						
						<view class="work_item">
							<view>
								<image :src="item.img"></image>
							</view>
							<view>
								<view class="price">
									<view>{{item.name}}</view>
									
									<view>{{item.type}}</view>
								</view>
								<view class="name">
									<view class="iconfont icon-gongsi"></view>
									<view>{{item.company}}</view>
								</view>
								<view class="time1">
									<view class="iconfont icon-shijian"></view>
									<view>{{item.time1}} - {{item.time2}}</view>
									<view>{{item.money}}/元每天</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				
			</view>
			
		</view>
		

	</view>
</template>

<script>
	export default {
		data() {
			return {
				jianzhi1:[],
				quanzhi1:[],
				flag:'',
				flag1:''
			}
		},
		onLoad() {
			this.quanzhi(),
			this.jianzhi()
		},
		methods: {
			//兼职
			async jianzhi(){
				console.log("兼职");
				const res = await this.$myRuquest({
					url:'/jianzhi'
				})
				this.flag=true
				this.flag1=false
				this.jianzhi1=res.data
			},
			
			//全职
			async quanzhi(){
				console.log("全职");
				const res = await this.$myRuquest({
					url:'/quanzhi'
				})
				this.flag1=true
				this.flag=false
				this.quanzhi1=res.data
			},
			
			//信息详情页
			jzDetail(id){
				console.log("兼职详情页触发")
				uni.navigateTo({
					url:'/pages/jz-detail/jz-detail?id='+id
				})
			},
			qzDetail(id){
				console.log("全职详情页触发")
				uni.navigateTo({
					url:'/pages/qz-detail/qz-detail?id='+id
				})
			}
			
		}
	}
</script>

<style  lang="scss">
	/* 导航 */
	.tar{
		display: flex;
		background-color: #eee;
		border-bottom: 6px solid #ccc;
		.nav_item:nth-child(1){
			border-right: 1px solid white;
			background-color: #04737C;
		}
		.nav_item:nth-child(2){
			background-color: #3F536E;
		}
		.nav_item{
			width: 50%;
			text-align: center;
			view{
				width: 120rpx;
				height: 100rpx;
				//background-color: #E88807;
				border-radius: 0rpx;
				margin: -3px auto;
				line-height: 100rpx;
				color: #E88807;
				font-size: 35px;
			}
			text{
				font-size: 35rpx;
				color: #E88807;
			}
		}
	}
	
	/* 兼职信息 */
	.body{
		/* background-color: #ccc; */
	}
	.work_list{
		padding: 0 15rpx 0px 0px;
		margin: 0 15rpx 0px 0px;
		flex-wrap: wrap;//换行
		justify-content: space-between;//左右间距
		.work_item{
			display: flex;//在一行显示
			background-color: #fff;
			width: 750rpx;
			margin: 10rpx 0px;
			padding: 10px 0px 10px 0px;
			border-bottom: 2px solid #ccc;
			padding: 15rpx;
			box-sizing: border-box;
			image{
				width: 160rpx;
				height: 160rpx;
				display: block;
				margin: 0 5rpx;//图片居中
			}
			.price{
				color: #000;
				font-size: 35rpx;
				margin: 7rpx 0;
				display: flex;//在一行显示
				justify-content:space-between;
				view:nth-child(2){
					position: absolute;
					right: 10px;
					color: #fff;
					background-color: #E88807;					border-radius: 5px;
					font-size: 26rpx;
					padding: 3px 2px;
					margin-left: 5rpx;
				}
			}
			.name{
				display: flex;//在一行显示
				font-size: 30rpx;
				line-height: 25rpx;
				margin-top:15px ;
				color: #2C405A;
				padding:10rpx 0px 10rpx 0rpx ;
			}
			.time1{
				font-size: 30rpx;
				margin: 15px 0px 0px 0px;;
				display: flex;//在一行显示
				color: #2C405A;
				view:nth-child(3){
					color: #E88807;
					font-size: 30rpx;
					position: absolute;
					right: 10px;
				}
			}
		}
	} 
</style>
